<template>
    <div class="singer">
        <div class="card" v-for="item in dataBase">
            <div class="image">
                <img v-if="item.image" :src="item.image">
            </div>
            <h1>{{item.name}}</h1>
            <h2></h2>
            <p>{{ item.introduction }}</p>
            <span href="#" @click="pushput(item)">了解更多</span>
        </div>
    </div>
</template>
  
<script>
import { mapState } from 'vuex'
export default {
    props:{
        dataBase:{
            type:Array
        }
    },

    methods:{
        pushput(val){
            this.$emit("getSingerInfo",val)
        }
    }
}
</script>
  
<style scoped lang="less">
*{
    margin: 0;
    padding: 0;
}
.singer{
  height: calc(100% - 100px);
  margin-top: 20px;
}
.singer{
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}
.card{
    position: relative;
    width: 240px;
    height: 280px;
    background-color: rgba(0,0,0,0.5);
    border-radius: 20px;
    margin: 10px 30px 20px 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    flex-shrink: 0;
}
.card .image img{
    height: 100%;
    width: 100%;
    object-fit: cover;//保持原有比例变化
}
.card .image{
    position: absolute;
    top: 0%;
    height: 100%;
    width: 100%;
    overflow: hidden;
    transition: 0.3s;
}
.card:hover .image{
    top: 20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.card .image ::before{
    content: "";
    position: absolute;
    height: 100%;
    width: 100%;
    background: linear-gradient(to bottom,transparent 50%,#222);
}
.card h1{
    position: absolute;
    top: 200px;
    font-size: 24px;
    transition: 0.5s;
}
.card:hover h1{
    top: 132px;
}
.card h2{
    margin-top: 150px;
    width: 80%;
    font-size: 20px;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.5);
}
.card p{
    width: 90%;
    text-indent: 32px;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 20px;
    overflow: hidden;
}
.card span{
    font-size: 15px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border:1px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    padding: 8px 32px;
    margin-bottom: 5px;
}
.card span:hover{
    cursor: pointer;
    color: #87CEFA;
    border:1px solid #87CEFA;
}
</style>